<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<html>
<head>
    <title>Book Shop</title>
    <link href="/resources/css/style.css" rel="stylesheet"/>
</head>
<body>
    <div class="main">
        <div class="header">
            LolShop
        </div>
        <div class="bookList">
            <table>
                <tr>
                    <th>Författare</th>
                    <th>Titel</th>
                    <th></th>
                </tr>
                <c:forEach items="${books}" var="book">
                    <tr>
                        <form:form commandName="book" method="post">
                            <input type="hidden" name="isbn" value="${book.isbn}" readonly/>
                            <td><input type="text" name="author" value="${book.author}" readonly/></td>
                            <td><input type="text" name="title" value="${book.title}" readonly/></td>
                            <td><input type="submit" value="Köp"/></td>
                        </form:form>
                    </tr>
                </c:forEach>
            </table>
        </div>
        <div class="shoppingCart">
            <table>
                <tr>
                    <th colspan="3">Kundvagn</th>
                </tr>
                <tr>
                    <th>Författare</th>
                    <th>Titel</th>
                    <th>Antal</th>
                </tr>
                <c:forEach items="${shoppingCart.books}" var="book">
                    <tr>
                        <td>${book.key.author}</td>
                        <td>${book.key.title}</td>
                        <td>${book.value}</td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
</body>
</html>